import {
    lib_type_list,
    face_alarm_type_List,
    genderList,
    event_type_list,
    behavior_alarm_type_list,
    status_alarm_type_list,
    violation_alarm_type_list,
    nonvehicle_alarm_type_list,
} from '@/utils/CONSTANT'
const alarm_type_list = [
    ...lib_type_list,
    ...behavior_alarm_type_list,
    ...status_alarm_type_list,
    ...violation_alarm_type_list,
    ...nonvehicle_alarm_type_list,
];
export function formatLibType(type) {
    if (!type && type !== 0) return '';
    return lib_type_list.find(item => item.value === type).label
}
export function formatEventType(type) {
    if (!type && type !== 0) return '';
    return event_type_list.find(item => item.value === type).label
}

export function formatEventsType(types) {
    if (!types) return '';
    let res = []
    let typeArr = types.split(',')
    typeArr.forEach(item => {
        res.push(alarm_type_list.find(item2 => item2.value === item).label)
    })
    return res.join(' ')
}

export function formatFaceType(type) {
    if (!type && type !== 0) return '';
    return face_alarm_type_List.find(item => item.value === type).label
}

export function formatGender(type) {
    if (!type && type !== 0) return '';
    const info = genderList.find(item => item.value === type);
    return info ? info.label : type;
}